#include "Deferred.fxh"

float3 g_Fog_Color;
float2 g_Fog_Params; // scale, bias

void FogPS(in float2 Pos : VPOS, in float3 EyeVec : TEXCOORD0, out float4 Out : COLOR0)
{
	GBUFFER_DATA Data;
	SampleGBuffers(Pos, EyeVec, Data);

	float FogFactor = saturate(Data.Pos_View.z * g_Fog_Params.x + g_Fog_Params.y);
	Out.rgb = g_Fog_Color;
	Out.a = FogFactor;
}

technique Fog {
	pass {
		AlphaBlendEnable = true;
		SrcBlend  = SRCALPHA;
		DestBlend = INVSRCALPHA;
		VertexShader = compile vs_3_0 MainVS();
		PixelShader  = compile ps_3_0 FogPS();
	}
}

